package com.jeethink.erp.buy.service.impl;

import java.util.List;
import com.jeethink.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jeethink.erp.buy.mapper.TbBuyMapper;
import com.jeethink.erp.buy.domain.TbBuy;
import com.jeethink.erp.buy.service.ITbBuyService;

/**
 * 进货Service业务层处理
 * 
 * @author ypr
 * @date 2021-05-31
 */
@Service
public class TbBuyServiceImpl implements ITbBuyService 
{
    @Autowired
    private TbBuyMapper tbBuyMapper;

    /**
     * 查询进货
     * 
     * @param buyId 进货ID
     * @return 进货
     */
    @Override
    public TbBuy selectTbBuyById(Long buyId)
    {
        return tbBuyMapper.selectTbBuyById(buyId);
    }

    /**
     * 查询进货列表
     * 
     * @param tbBuy 进货
     * @return 进货
     */
    @Override
    public List<TbBuy> selectTbBuyList(TbBuy tbBuy)
    {
        return tbBuyMapper.selectTbBuyList(tbBuy);
    }

    /**
     * 新增进货
     * 
     * @param tbBuy 进货
     * @return 结果
     */
    @Override
    public int insertTbBuy(TbBuy tbBuy)
    {
        tbBuy.setCreateTime(DateUtils.getNowDate());
        return tbBuyMapper.insertTbBuy(tbBuy);
    }

    /**
     * 修改进货
     * 
     * @param tbBuy 进货
     * @return 结果
     */
    @Override
    public int updateTbBuy(TbBuy tbBuy)
    {
        tbBuy.setUpdateTime(DateUtils.getNowDate());
        return tbBuyMapper.updateTbBuy(tbBuy);
    }

    /**
     * 批量删除进货
     * 
     * @param buyIds 需要删除的进货ID
     * @return 结果
     */
    @Override
    public int deleteTbBuyByIds(Long[] buyIds)
    {
        return tbBuyMapper.deleteTbBuyByIds(buyIds);
    }

    /**
     * 删除进货信息
     * 
     * @param buyId 进货ID
     * @return 结果
     */
    @Override
    public int deleteTbBuyById(Long buyId)
    {
        return tbBuyMapper.deleteTbBuyById(buyId);
    }
}
